﻿using System.ComponentModel.DataAnnotations;


namespace LiteBlog.Models
{
    public class ChangePasswordModel : LoginModel
    {
        public ChangePasswordModel(string name, string oldPassword, string newPassword, string repeatPassword)
        {
            Name = name;
            Password = oldPassword;
            NewPassword = newPassword;
            RepeatPassword = repeatPassword;
        }

        public ChangePasswordModel(LoginModel loginModel, string newPassword, string repeatPassword) 
                : this(loginModel.Name, loginModel.Password, newPassword, repeatPassword)
        {
            
        }

        public ChangePasswordModel() : this(string.Empty, string.Empty, string.Empty, string.Empty)
        {
        }

        [Required(ErrorMessage = "Please enter a new password")]
        public string NewPassword { get; set; }

        [Required(ErrorMessage = "Please enter the new password again")]
        [Compare("NewPassword", ErrorMessage="The password entered should match the new password")]
        public string RepeatPassword { get; set; }
    }
}